//
//  ZSY_DestinationDetailViewController.m
//  zsy_BreadTrip
//
//  Created by dllo on 15/12/28.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "ZSY_DestinationDetailViewController.h"

@interface ZSY_DestinationDetailViewController ()

@property (nonatomic, retain) UIWebView *webView;

@end

@implementation ZSY_DestinationDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    self.view.backgroundColor = [UIColor lightGrayColor];
    
//    self.slug_url = @"/2/6636/";
//    [ZSY_AppTools creatingDataTask: [NSString stringWithFormat:@"http://api.breadtrip.com/destination/place%@", self.slug_url] parameters:nil Cookie:nil User_Agent:nil successAFNBlock:^(id resuposeObject) {
//        NSLog(@"=======%@", resuposeObject);
//        
//    }];
    
    self.navigationController.navigationBar.hidden = NO;
    CGRect frame = self.view.frame;
    frame.size.height -= 64;
    
    self.webView = [[UIWebView alloc] initWithFrame:frame];
    
    NSString *string = [NSString stringWithFormat:@"http://web.breadtrip.com%@",self.url];
    NSURL *url = [NSURL URLWithString:string];
    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
    [self.webView loadRequest:request];
    
    [self.view addSubview:self.webView];
    [_webView release];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"add_new_poi_back_btn"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(backAction:)];
    
    
}
- (void)backAction:(UIButton *)button {
    if ([self.webView canGoBack]) {
        
        [self.webView goBack];
    }else{
        
        [self.navigationController popViewControllerAnimated:YES];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
